package com.macasa.panel.dao.hibernate.impl;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.macasa.panel.dao.hibernate.api.IUserDao;
import com.macasa.panel.entity.impl.User;
import com.macasa.panel.exception.DAOException;

@Repository("userDao")
@Scope("singleton")
public class UserDao extends AbstractGenericHibernateDao<User, Integer> implements IUserDao {

	/**
	 * The Constant serialVersionUID
	 */
	private static final long	serialVersionUID	= -2827180228399318104L;

	@Override
	@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
	public User getUserByLogin(final String login) throws DAOException {

		return super.findByUniqueAttribute("login", login);
	}

}
